﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StockTrader.BusinessService.DataContract.HnxInfo
{
    public class HnxLeData
    {
        public DateTime TradingDate { set; get; }
        public string Time { set; get; }
        public int StockId { set; get; }
        public int Price { set; get; }
        public long Qtty { set; get; }
        public long AccQtty { set; get; }
        public decimal AccValue { set; get; }
        public long TimeStamp { set; get; }

        public HnxLeData() { }

        public HnxLeData(HnxStockData stock)
        {
            TradingDate = stock.TradingDate;
            Time = stock.Time;
            StockId = stock.StockId;
            Price = stock.MatchPrice;
            Qtty = stock.MatchQtty;
            AccQtty = stock.TotalTradedQtty;
            AccValue = stock.TotalTradedValue;
            TimeStamp = DateTime.Now.Ticks;
        }

        public override bool Equals(object obj)
        {
            if (StockId.Equals(((HnxLeData)obj).StockId))
                return AccQtty.Equals(((HnxLeData)obj).AccQtty);
            else
                return StockId.Equals(((HnxLeData)obj).StockId);
        }
    }
}
